package com.ztgf.shopping.api.client.epg;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.ztgf.common.constant.Result;
import com.ztgf.common.enums.CodeEnum;
import com.ztgf.shopping.models.bo.epg.EpgTopicBO;
import com.ztgf.shopping.models.vo.epg.EpgTopicVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;
import com.ztgf.shopping.models.service.epg.IEpgZtgfInfoService;
import com.ztgf.shopping.models.bo.epg.EpgZtgfInfoBO;
import com.ztgf.shopping.models.dto.epg.EpgZtgfInfoDTO;

import java.util.List;

/**
 * 中铁工服信息配置控制器
 *
 * @author YUE
 * @Date 2020-05-29 15:20:13
 */

@RestController
@RequestMapping("/api/epgZtgfInfo")
@Slf4j
@Api(value = "EpgZtgfInfoApiController",tags = "中铁工服信息配置Api接口")
public class EpgZtgfInfoApiController {

    @DubboReference
    private IEpgZtgfInfoService epgZtgfInfoService;

    /**
     * 中铁工服信息配置 根据功能id
     * @param moduleId 功能id
     * @return
     */
    @ApiOperation(value = "中铁工服信息配置 列表 根据功能id",notes = "中铁工服信息配置 列表 根据功能id")
    @PostMapping("/getListByModuleId")
    public Result<List<EpgZtgfInfoDTO>> getListByModuleId(Long moduleId){
        EpgZtgfInfoBO epgZtgfInfoBO = new EpgZtgfInfoBO();
        epgZtgfInfoBO.setModuleId(moduleId);
        List<EpgZtgfInfoDTO> epgZtgfInfoDTOList = epgZtgfInfoService.getBySelectZtgfInfoNoPage(epgZtgfInfoBO);
        return new Result<>(epgZtgfInfoDTOList);
    }

    @PostMapping("/get")
    @ApiOperation(value = "根据id查找",notes = "根据id查找")
    @ApiImplicitParam(name = "id",value = "id",required = true,paramType = "query", dataType = "Long")
    public Result<EpgZtgfInfoDTO> get(@RequestParam("id") Long id){
        if(id == null){
            return new Result<>(CodeEnum.FAIL_100002 );
        }

        EpgZtgfInfoDTO dto = epgZtgfInfoService.selectById(id);

        return new Result<>(dto);
    }

    @ApiOperation(value = "中铁工服信息配置列表",notes = "中铁工服信息配置列表")
    @PostMapping("/querySelectList")
    public Result<List<EpgZtgfInfoDTO>> querySelectList(EpgZtgfInfoBO bo){
        if(null == bo)
            return new Result<>(CodeEnum.FAIL_100002 );
        List<EpgZtgfInfoDTO> epgZtgfInfoDTOList = epgZtgfInfoService.getBySelectZtgfInfoNoPage(bo);
        return new Result<>(epgZtgfInfoDTOList);
    }
}
